package cn.com.dhcc.adam.spring.validation;

import org.springframework.validation.BindingResult;
import org.springframework.validation.DataBinder;
import org.springframework.validation.Validator;

public class ValidatorTest {
	
	public static void main(String[] args) {
		Person per = new Person();
		per.setName("cd");
		
		DataBinder binder = new DataBinder(per);
		Validator validator = new PersonValidator();
		binder.setValidator(validator );
		binder.validate();
		BindingResult br = binder.getBindingResult();
		System.out.println("验证结果：" + br);
	}
}
